namespace TXLooker.WorkItemExtention.WIQL
{
    using System;
    using System.Reflection;

    public class NodeFieldList : NodeVariableList
    {
        public NodeFieldList(NodeType nodeType) : base(nodeType)
        {
        }

        public override void Bind(IExternal e, NodeTableName tableContext, NodeFieldName fieldContext)
        {
            base.BindChildren(e, tableContext, fieldContext);
            for (int i = 0; i < this.Count; i++)
            {
                Tools.EnsureSyntax(this[i].NodeType == NodeType.FieldName, SyntaxError.ExpectingFieldName, this[i]);
            }
            base.Bind(e, tableContext, fieldContext);
        }

        public override Node Optimize(IExternal e, NodeTableName tableContext, NodeFieldName fieldContext)
        {
            base.OptimizeChildren(e, tableContext, fieldContext);
            return base.Optimize(e, tableContext, fieldContext);
        }

        public new NodeFieldName this[int i]
        {
            get
            {
                return (NodeFieldName) base[i];
            }
            set
            {
                base[i] = value;
            }
        }

        public override Priority Priority
        {
            get
            {
                return Priority.CommaOperator;
            }
        }
    }
}

